package com.scripts;

import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.safari.SafariDriver;
import org.testng.*;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
import java.util.concurrent.TimeUnit;

/**
 * Created by orlandocampos on 10/2/14.
 */
public class Test2 {

    //System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");

    protected static WebDriver wd;

    protected static String result;

    @BeforeClass

    public static void setup()  {

        //wd = new FirefoxDriver();
        //wd = new ChromeDriver();
        wd = new SafariDriver();


        wd.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

    }

    @Test

    void Testcase1() {

        wd.get("http://www.floraindia.com");

        wd.findElement(By.id("kwsch")).sendKeys("Red");

        wd.findElement(By.xpath("//input[@src='images/go.gif']")).click();

        result = wd.findElement(By.xpath("//font[text()='Total Items :']//following::td[1]")).getText();

        Assert.assertEquals(result, "115");

    }

    @AfterClass

    public static void teardown()  {

        wd.close();

        wd.quit();

    }

}